/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package model;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.annotation.PostConstruct;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.*;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author shinji
 */
@Entity
@Table(name = "Member")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Member1.findAll", query = "SELECT m FROM Member1 m"),
    @NamedQuery(name = "Member1.findById", query = "SELECT m FROM Member1 m WHERE m.id = :id"),
    @NamedQuery(name = "Member1.findByUsername", query = "SELECT m FROM Member1 m WHERE m.username = :username"),
    @NamedQuery(name = "Member1.findByPassword", query = "SELECT m FROM Member1 m WHERE m.password = :password"),
    @NamedQuery(name = "Member1.findByFullName", query = "SELECT m FROM Member1 m WHERE m.fullName = :fullName"),
    @NamedQuery(name = "Member1.findByNickName", query = "SELECT m FROM Member1 m WHERE m.nickName = :nickName"),
    @NamedQuery(name = "Member1.findByBirthday", query = "SELECT m FROM Member1 m WHERE m.birthday = :birthday"),
    @NamedQuery(name = "Member1.findByGender", query = "SELECT m FROM Member1 m WHERE m.gender = :gender"),
    @NamedQuery(name = "Member1.findByEmail", query = "SELECT m FROM Member1 m WHERE m.email = :email"),
    @NamedQuery(name = "Member1.findByHeight", query = "SELECT m FROM Member1 m WHERE m.height = :height"),
    @NamedQuery(name = "Member1.findByContactNumber", query = "SELECT m FROM Member1 m WHERE m.contactNumber = :contactNumber"),
    @NamedQuery(name = "Member1.findByWorkingAt", query = "SELECT m FROM Member1 m WHERE m.workingAt = :workingAt"),
    @NamedQuery(name = "Member1.findByFamily", query = "SELECT m FROM Member1 m WHERE m.family = :family"),
    @NamedQuery(name = "Member1.findByAddress", query = "SELECT m FROM Member1 m WHERE m.address = :address"),
    @NamedQuery(name = "Member1.findByHobbies", query = "SELECT m FROM Member1 m WHERE m.hobbies = :hobbies"),
    @NamedQuery(name = "Member1.findByExpirationDate", query = "SELECT m FROM Member1 m WHERE m.expirationDate = :expirationDate")})
public class Member1 implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "ID")
    private Integer id;
    @Size(max = 50)
    @Column(name = "Username")
    private String username;
    @Size(max = 50)
    @Column(name = "Password")
    private String password;
    @Size(max = 50)
    @Column(name = "Avatar")
    private String avatar;
    @Size(max = 50)
    @Column(name = "FullName")
    private String fullName;
    @Size(max = 50)
    @Column(name = "NickName")
    private String nickName;
    @Column(name = "Birthday")
    @Temporal(TemporalType.TIMESTAMP)
    private Date birthday;
    @Column(name = "Gender")
    private Boolean gender;
    //@Pattern(regexp = "[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?", message = "Email : Invalid email demo!!!")
    @Size(max = 50)
    @Column(name = "Email")
    private String email;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "Height")
    private BigDecimal height;
    @Size(max = 15)
    @Column(name = "ContactNumber")
    private String contactNumber;
    @Size(max = 50)
    @Column(name = "WorkingAt")
    private String workingAt;
    @Size(max = 50)
    @Column(name = "Family")
    private String family;
    @Size(max = 50)
    @Column(name = "Address")
    private String address;
    @Size(max = 50)
    @Column(name = "Hobbies")
    private String hobbies;
    //@Size(max = 10)
    @Column(name = "ExpirationDate")
    @Temporal(TemporalType.DATE)
    private Date expirationDate;
    @Column(name = "OnlineStatus")
    private Boolean onlineStatus;
    @ManyToMany(mappedBy = "member1List")
    private List<Likings> likingsList = new ArrayList<>();
    @JoinColumn(name = "ID_State", referencedColumnName = "ID")
    @ManyToOne(optional = false)
    private State iDState = new State();
    @JoinColumn(name = "ID_Permission", referencedColumnName = "ID")
    @ManyToOne(optional = false)
    private Role iDPermission = new Role();
    @JoinColumn(name = "ID_Religion", referencedColumnName = "ID")
    @ManyToOne(optional = false)
    private Religion iDReligion = new Religion();
    @JoinColumn(name = "ID_Marital", referencedColumnName = "ID")
    @ManyToOne(optional = false)
    private Marital iDMarital = new Marital();
    @JoinColumn(name = "ID_Language", referencedColumnName = "ID")
    @ManyToOne(optional = false)
    private Language iDLanguage = new Language();
    @JoinColumn(name = "ID_Casle", referencedColumnName = "ID")
    @ManyToOne(optional = false)
    private Caste iDCasle = new Caste();
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "iDMember")
    private List<Friend> friendList = new ArrayList<>();
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "iDFriend")
    private List<Friend> friendList1 = new ArrayList<>();
    @OneToMany(mappedBy = "iDMember")
    private List<Album> albumList;

    public Member1() {
    }

    public Member1(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public String getAvatar() {
        return avatar;
    }

    public void setAvatar(String avatar) {
        this.avatar = avatar;
    }

    public Boolean getOnlineStatus() {
        return onlineStatus;
    }

    public void setOnlineStatus(Boolean onlineStatus) {
        this.onlineStatus = onlineStatus;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getFullName() {
        return fullName;
    }

    public void setFullName(String fullName) {
        this.fullName = fullName;
    }

    public String getNickName() {
        return nickName;
    }

    public void setNickName(String nickName) {
        this.nickName = nickName;
    }

    public Date getBirthday() {
        return birthday;
    }

    public void setBirthday(Date birthday) {
        this.birthday = birthday;
    }

    public Boolean getGender() {
        return gender;
    }

    public void setGender(Boolean gender) {
        this.gender = gender;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public BigDecimal getHeight() {
        return height;
    }

    public void setHeight(BigDecimal height) {
        this.height = height;
    }

    public String getContactNumber() {
        return contactNumber;
    }

    public void setContactNumber(String contactNumber) {
        this.contactNumber = contactNumber;
    }

    public String getWorkingAt() {
        return workingAt;
    }

    public void setWorkingAt(String workingAt) {
        this.workingAt = workingAt;
    }

    public String getFamily() {
        return family;
    }

    public void setFamily(String family) {
        this.family = family;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getHobbies() {
        return hobbies;
    }

    public void setHobbies(String hobbies) {
        this.hobbies = hobbies;
    }

    public Date getExpirationDate() {
        return expirationDate;
    }

    public void setExpirationDate(Date expirationDate) {
        this.expirationDate = expirationDate;
    }

    @XmlTransient
    public List<Likings> getLikingsList() {
        return likingsList;
    }

    public void setLikingsList(List<Likings> likingsList) {
        this.likingsList = likingsList;
    }

    public State getIDState() {
        return iDState;
    }

    public void setIDState(State iDState) {
        this.iDState = iDState;
    }

    public Role getIDPermission() {
        return iDPermission;
    }

    public void setIDPermission(Role iDPermission) {
        this.iDPermission = iDPermission;
    }

    public Religion getIDReligion() {
        return iDReligion;
    }

    public void setIDReligion(Religion iDReligion) {
        this.iDReligion = iDReligion;
    }

    public Marital getIDMarital() {
        return iDMarital;
    }

    public void setIDMarital(Marital iDMarital) {
        this.iDMarital = iDMarital;
    }

    public Language getIDLanguage() {
        return iDLanguage;
    }

    public void setIDLanguage(Language iDLanguage) {
        this.iDLanguage = iDLanguage;
    }

    public Caste getIDCasle() {
        return iDCasle;
    }

    public void setIDCasle(Caste iDCasle) {
        this.iDCasle = iDCasle;
    }

    @XmlTransient
    public List<Friend> getFriendList() {
        return friendList;
    }

    public void setFriendList(List<Friend> friendList) {
        this.friendList = friendList;
    }

    @XmlTransient
    public List<Friend> getFriendList1() {
        return friendList1;
    }

    public void setFriendList1(List<Friend> friendList1) {
        this.friendList1 = friendList1;
    }

    @XmlTransient
    public List<Album> getAlbumList() {
        return albumList;
    }

    public void setAlbumList(List<Album> albumList) {
        this.albumList = albumList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Member1)) {
            return false;
        }
        Member1 other = (Member1) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "model.Member1[ id=" + id + " ]";
    }
}
